{% extends "base.html" %}
{% load static %}

{% block content %}
    <div class="row">


    <div class="tab-pane fade" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
    <!-- 客户基本信息展示 -->
    <!-- 显示客户基本信息表格 -->
    <!-- 显示修改客户基本信息的模态框 -->
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
        修改客户信息
    </button>
    <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalCenterTitle">修改客户基本信息</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form method="post" action="{% url 'Kehu_detail' pk=object.id %}">
                        {% csrf_token %}
                        {{ kehu_form.as_p }}
                        <button type="submit" name="form_key" value="xinxi">更新客户信息</button>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">保存更改</button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 类似地为其他表单创建模态框 -->

<div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">
    <!-- 跟进记录表单 -->
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#genjinlogModal">
        添加跟进记录
    </button>
    <div class="modal fade" id="genjinlogModal" tabindex="-1" role="dialog" aria-labelledby="genjinlogModalTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="genjinlogModalTitle">添加跟进记录</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form method="post" action="{% url 'Kehu_detail' pk=object.id %}">
                        {% csrf_token %}
                        {{ genjinlog_form.as_p }}
                        <button type="submit" name="form_key" value="genjinlog">保存</button>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">保存更改</button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 为其他表单类似地创建模态框 -->





    </div>
{% endblock %}
{% block footerjs %}
<script>
document.addEventListener("DOMContentLoaded", function() {
  // 获取 URL 中的锚点部分
  var hash = window.location.hash;
  // 检查是否指定了有效的标签页 ID（去掉前面的 # 号）
  if (hash && hash.startsWith("#")) {
    var tabToShow = hash.substring(1); // 去掉 # 号
    $('a[href="#' + tabToShow + '"]').tab('show');
  }

});
</script>
{% endblock %}